
package com.zhu.salesmanagement;

import com.zhu.location.R;
import com.zhu.salesmanagement.models.VisitTaskInfo;
import com.zhu.salesmanagement.views.ProductInfoListView;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;


public class ProductInfoListActivity extends Activity implements View.OnClickListener {

    public static final int UPDATE_DB = 1000;

    private VisitTaskInfo mVisitTaskInfo = null;

    private ProductInfoListView mProductInfoListView = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        Parcelable parcelable = getIntent().getParcelableExtra("info");
        mVisitTaskInfo = (VisitTaskInfo) parcelable;

        LayoutInflater mInflater = getLayoutInflater();
        mProductInfoListView = (ProductInfoListView) mInflater.inflate(
                R.layout.productinfolist_view, null);

        setContentView(mProductInfoListView);

        mProductInfoListView.initData(mVisitTaskInfo, this);
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

    };

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode != RESULT_OK) {
            return;
        }
        switch (requestCode) {
            case UPDATE_DB:
                long id = data.getLongExtra("id", ProductInfoListView.INVALID_VALUE);
                mProductInfoListView.updateDbId(id);
                break;
        }
    }
}
